﻿@model BudgetMealsModels.Entities.User

@{
    ViewBag.Title = "Edit";
}
@{ Html.RenderPartial("TinyMCE", new string[] { "#Biography" }); }

<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>

@using (Html.BeginForm("Edit", "User", FormMethod.Post, new { enctype="multipart/form-data"}))
{
    @Html.ValidationSummary(true)


        @Html.HiddenFor(model => model.UserID)
        @Html.HiddenFor(model => model.UserName)
        @Html.HiddenFor(model => model.ImageData)
        @Html.HiddenFor(model => model.ImageMimeType)

        <div class="editor-label">
            First Name
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.FirstName)
            @Html.ValidationMessageFor(model => model.FirstName)
        </div>

        <div class="editor-label">
            Last Name
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.LastName)
            @Html.ValidationMessageFor(model => model.LastName)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Email)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Email)
            @Html.ValidationMessageFor(model => model.Email)
        </div>
        <br />
        <br />
    <br />
    <br />
    <br />
        <div style="position: absolute; right:65px; top:10px;">
            <div class="editor-label">
                @Html.LabelFor(model => model.Biography)
            </div>
            <div class="editor-field">
                @Html.TextAreaFor(model => model.Biography, 6, 50, null)
                @Html.ValidationMessageFor(model => model.Biography)
            </div>
            <div class="editor-label">Image</div>
            <div class="example">Upload a .jpeg, .jpg, or .png</div>
            <div class="editor-field">
                @if (Model.ImageData == null)
            {
                @:None
            }
            else
            {
                <img width="90" height="150" src="@Url.Action("GetImage", "User", new { Model.UserID })" />
            }
               <div>Upload profile image here:<input name="image" type="file" /></div>
            </div>

        </div>
        <p>
            <input type="submit" value="Save" />
        </p>
}

<div>
    @Html.ActionLink("Back to profile", "Profile", new { id = Model.UserID })
</div>
